Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Displaying Rendered • View rawDownload


example.mu main (13cc24bf) Text, 1.55 KB

import core
import os

if 'link_id' not in os.environ:
os.environ['link_id'] = 'local_test'

current_session = core.get_current_session(os.environ['link_id'])

core.header(current_session)

print('''This page demonstrates how to add content, and define who can see it.
''')

if current_session:
print('''User logged in.
Display content to logged in users here.

Examples of other "plugins" for logged in users:

''')

# OPTIONAL:
# Only display if user has a role. A role can be anything. It is a text string.
if current_session['role'] == 'admin':
print('You have the role admin.')

if current_session['role'] == 'moderator':
print('You have the role moderator.')

if current_session['role'] == 'user':
print('You have the role user.')

if not current_session:
print('''
User not logged in.
''')

print('''Everyone can see this.

"Plugins" that anyone can view:





''')

core.footer()


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────